package com.nfIt.sumThread;

/**
 * ClossName:MainTest
 * Pakage:com.nfIt
 * Description
 *
 * @Author L
 * @Create 2024/3/20 8:42
 * @Version 2023.1.3
 */
public class MainTest {
    public static void main(String[] args) throws InterruptedException {
        SumThread sumThread1 = new SumThread(1,100);
        SumThread sumThread2 = new SumThread(101,900);
        SumThread sumThread3 = new SumThread(901,1000);

        sumThread1.start();
        sumThread2.start();
        sumThread3.start();

        //等待sumThread1,sumThread2,sumThread3执行完，主线程在执行
        sumThread1.join();
        sumThread2.join();
        sumThread3.join();

       int r = sumThread1.getSum()+sumThread2.getSum()+ sumThread3.getSum();

       System.out.println("和为："+r);



    }
}
